1. Technical Field
The present invention generally relates to computer systems and in particular to a method and system for managing keyboard navigation within a tree control structure user interface (UI).
2. Description of the Related Art
Navigating through a Dynamic HyperText Markup Language (HTML)-based tree control structure UI component can present challenges to users who require assistive technologies. Conventional HTML-based implementations of a tree control operation have generally utilized mouse navigation. Mouse navigation obviates the problem of determining the “next” (i.e. previous or subsequent) node to navigate to since the user controls mouse navigation by directly clicking on a tree item to set focus to the tree item. However, in the case of users requiring assistive technologies, keyboard navigation, as opposed to mouse navigation, is the preferred tool with which the user can navigate through a tree control structure.
Implementing keyboard navigation of a tree control structure does present some challenges. In a Dynamic HTML-based tree control structure UI component, providing keyboard navigation to a tree control structure is difficult because of the varying expanded and collapsed states of tree nodes. In contrast to mouse navigation, keyboard navigation requires arrowing up and down within a tree control structure until the desired item is reached. For example, when arrowing down in a tree control structure, all of the expanded or visible intermediate tree items of a particular branch are navigated to before navigating to the next desired tree item.
In keyboard navigation of a tree control structure, determining the subsequent and previous nodes when traversing the tree control structure depends upon the expanded and collapsed state of the tree items of the tree control structure. One possible way to determine the next tree item to traverse when navigating through the tree control structure is to identify each tree item in the tree control structure based on the tree item's order within the tree control structure when all of the tree items are expanded and to mark each tree item as visible or hidden. Thus, to navigate down the tree control structure, the current tree item would be queried for the current tree item's identification (ID), which is usually associated with a numeral, such that the next item in the tree would be identified as ID+1. The ID+1 tree item would be obtained and queried to determine if the ID+1 tree item is expanded ID+1's children are visible. If the ID+1 tree item is visible, ID+1 would become the next navigable tree item. However, if ID+1 is not visible, the search would continue for the next visible tree item by adding 1 again and querying the next tree item (i.e. ID+2). Thus, in order to traverse downwards in the tree, each subsequent tree item after the current tree item would have to be queried to determine whether each subsequent tree item is visible or not.
Continuing with the method described above, when a particular tree item is collapsed, all of the children of that particular tree item would need to be updated to reflect that the children are no longer visible. Likewise, when a particular tree item is expanded, all of the children of that particular tree item would need to be updated to reflect that the children are now visible. Notably, the updating of collapsed or expanded tree items requires a recursive search since tree items may themselves contain additional branch tree items, each branch tree item having its own collapsed or expanded state. This method of (i) ordering nodes in sequential order, (ii) keeping track of the expanded and collapsed state of each branch tree item, and (iii) keeping track of the visible and hidden state of all the tree items is deemed too complex for conventional keyboard navigation of a tree control structure.
Another method for keyboard navigation of a tree control structure is to number the tree items sequentially based on their respective level within the tree control structure's hierarchy. The level in the hierarchy would be used as the ID of the tree item. At each subsequent level in the hierarchy, the numbering would begin again. In addition, each tree item would be labeled as expanded or collapsed. Under such an implementation, when arrowing down, the current tree item would be identified and checked to see if the current tree item has children. If the tree item has children and is expanded, first child of the tree item would be deemed the next tree item. If the tree item either does not have children, as in the case of a leaf tree item, or is not expanded, the next tree item would be the current tree item number+1. Similar to the first method disclosed above, this second method also represents a complex scheme because the second method relies on the numbering of tree items in a specific sequence for determining the next tree item to which to navigate. Moreover, neither of the above methods can be implemented if tree items have been added or removed from the tree control structure after the tree structure has been created and the IDs of the tree items have been assigned.